home *** CD-ROM | disk | FTP | other *** search
/ Hardcore Visual Basic 5.0 (2nd Edition) / Hardcore Visual Basic 5.0 - Second Edition (1997)(Microsoft Press).iso / Code / MODGLO~2.CLS < prev    next >
Text File  |  1997-06-14  |  2KB  |  83 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4. END
  5. Attribute VB_Name = "CModGlobFilter"
  6. Attribute VB_GlobalNameSpace = False
  7. Attribute VB_Creatable = True
  8. Attribute VB_PredeclaredId = False
  9. Attribute VB_Exposed = False
  10. Option Explicit
  11.  
  12. Implements IFilter
  13.  
  14. Private sSource As String, sTarget As String
  15. Private sName As String
  16.  
  17. ' CModGlobFilter-specific methods and properties
  18. Public Property Let Name(sNameA As String)
  19.     sName = sNameA
  20. End Property
  21. Public Property Get Name() As String
  22.     Name = sName
  23. End Property
  24.  
  25. ' IFilter implementation
  26. Private Property Let IFilter_Source(sSourceA As String)
  27.     sSource = sSourceA
  28. End Property
  29. Private Property Get IFilter_Source() As String
  30.     IFilter_Source = sSource
  31. End Property
  32.  
  33. Private Property Let IFilter_Target(sTargetA As String)
  34.     sTarget = sTargetA
  35. End Property
  36. Private Property Get IFilter_Target() As String
  37.     IFilter_Target = sTarget
  38. End Property
  39.  
  40. Private Function IFilter_Translate(sLineA As String, ByVal iLineA As Long) As EChunkAction
  41.     ' Translate every line
  42.     IFilter_Translate = ecaTranslate
  43.     ' Change only the first line of module
  44.     If iLineA = 1 Then CreateGlobHeader sLineA
  45. End Function
  46.  
  47. Private Sub CreateGlobHeader(sLine As String)
  48.     Dim sTok As String, sSep As String
  49.  
  50.     ' Parse module header
  51.     sSep = " " & sTab
  52.     sTok = GetQToken(sLine, sSep)
  53.     BugAssert sTok = "Attribute"
  54.     sTok = GetQToken(sEmpty, sSep)
  55.     BugAssert sTok = "VB_Name"
  56.     sTok = GetQToken(sEmpty, sSep)
  57.     BugAssert sTok = "="
  58.     
  59.     ' Use default global name if global name isn't already set
  60.     If sName = sEmpty Then
  61.         sName = GetQToken(sEmpty, sSep)
  62.         ' Remove this block if you don't use M as a tag on standard modules
  63.         If Left$(sName, 1) = "M" Then
  64.             sName = "G" & Right$(sName, Len(sName) - 1)
  65.         Else
  66.             sName = "G" & sName
  67.         End If
  68.     End If
  69.     
  70.     ' Generate global class header
  71.     sLine = "VERSION 1.0 CLASS" & sCrLf & _
  72.             "BEGIN" & sCrLf & _
  73.             "  MultiUse = -1  'True" & sCrLf & _
  74.             "END" & sCrLf & _
  75.             "Attribute VB_Name = " & sQuote2 & sName & sQuote2 & sCrLf & _
  76.             "Attribute VB_GlobalNameSpace = True" & sCrLf & _
  77.             "Attribute VB_Creatable = True" & sCrLf & _
  78.             "Attribute VB_PredeclaredId = False" & sCrLf & _
  79.             "Attribute VB_Exposed = True"
  80. End Sub
  81.  
  82.  
  83.